import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import mitt from "mitt";
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import store from './stores'
//svg插件需要配置代码
import 'virtual:svg-icons-register';
import svgIcons from '@/components/svgIcons/index.vue'
import { initVConsole } from './utils/vconsole'

var app = createApp(App)
app.use(ElementPlus)
const Mit = mitt()
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
// TypeScript注册，必须注册ComponentCustomProperties类型才能获得类型提示
declare module 'vue' {
    export interface ComponentCustomProperties {
        emitter: typeof Mit
    }
}
// 全局挂载emitter方法
app.config.globalProperties.emitter = Mit
app.config.globalProperties.origin = import.meta.env.MODE == 'development'?'https:aimeta.huilan.com:32108/':window.location.origin
app.use(store)
// 注册全局组件
app.component('svg-icon', svgIcons);
app.mount('#app')

// 初始化vConsole（根据URL参数debug=1开启）
initVConsole();
